/*
 * Copyright (c) 2016. For Intelligent Group.
 */

package com.intelligent.ispc.core.repository;

import com.intelligent.ispc.core.entity.User;
import com.intelligent.ispc.core.repository.mybatis.MyBatisRepository;

import java.util.List;

/**
 * Created by Peter on 2016/7/11.
 */

@MyBatisRepository
public interface UserDao {

    /**
     * Find users by conditions.
     *
     * @param user condition.
     * @return list.
     */
    List<User> findByCondition(User user);

    /**
     * Find user by id.
     *
     * @param id id.
     * @return User.
     */
    User findById(Long id);

    /**
     * Find user by login name.
     *
     * @param loginName login name.
     * @return User.
     */
    User findByLoginName(String loginName);

    /**
     * Update user information.
     *
     * @param user login name.
     */
    void updateByUserId(User user);

    /**
     * Find user's roles.
     *
     * @param userid user id.
     * @return role ids.
     */
    List<Long> findRoleByUserId(Long userid);
}
